Skip to content

Add Unit Tests for MCP feature #3787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 30, 2025

Conversation

rithin-pullela-aws
Copy link
Contributor

@rithin-pullela-aws rithin-pullela-aws commented Apr 28, 2025

Description

Adds Unit tests for MCP feature

this tests the files:

We use the getConnector function in agent utils. To test the getMcpToolSpecs, we need to mock the internals of the get connector function using stubGetConnector() function in AgentUtilsTest.java. We extend the AgentUtilsTest class with MLStaticMockBase to mock the static methods inside getConenctor() function of AgentUtils

Related Issues

Resolves #3743

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: rithin-pullela-aws <[email protected]>
Signed-off-by: rithin-pullela-aws <[email protected]>
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 14, 2025 21:46 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 14, 2025 21:46 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 14, 2025 21:46 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 14, 2025 21:46 — with GitHub Actions Inactive
Signed-off-by: rithin-pullela-aws <[email protected]>
@rithin-pullela-aws rithin-pullela-aws marked this pull request as ready for review May 14, 2025 22:01
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 14, 2025 22:02 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 14, 2025 22:02 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 14, 2025 22:02 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 14, 2025 22:02 — with GitHub Actions Inactive
@dhrubo-os
Copy link
Collaborator

are we planning to add any integration test too?

Copy link

codecov bot commented May 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.83%. Comparing base (6187de8) to head (156787c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3787      +/-   ##
============================================
+ Coverage     77.98%   78.83%   +0.84%     
- Complexity     7388     7450      +62     
============================================
  Files           658      658              
  Lines         33279    33279              
  Branches       3749     3749              
============================================
+ Hits          25954    26236     +282     
+ Misses         5719     5396     -323     
- Partials       1606     1647      +41     
Flag Coverage Δ
ml-commons 78.83% <ø> (+0.84%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rithin-pullela-aws rithin-pullela-aws had a problem deploying to ml-commons-cicd-env-require-approval May 14, 2025 23:13 — with GitHub Actions Failure
@rithin-pullela-aws
Copy link
Contributor Author

are we planning to add any integration test too?

@dhrubo-os, not in this PR.

Building ITs for MCP use case is not straight forward, because we would want an MCP server running to test the capability. We can perhaps use the MCP Server in openSearch to write ITs and test, I will look into it.

@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 15, 2025 01:22 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 15, 2025 01:22 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 15, 2025 01:22 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 15, 2025 01:22 — with GitHub Actions Inactive
@rithin-pullela-aws rithin-pullela-aws requested a deployment to ml-commons-cicd-env-require-approval May 15, 2025 02:26 — with GitHub Actions Waiting
@rithin-pullela-aws rithin-pullela-aws requested a deployment to ml-commons-cicd-env-require-approval May 15, 2025 02:26 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 22, 2025 18:43 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 22, 2025 18:43 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 22, 2025 18:43 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 22, 2025 18:43 — with GitHub Actions Waiting
@brianf-aws
Copy link
Contributor

brianf-aws commented May 22, 2025

Hey @rithin-pullela-aws. What are some reviewing objectives? I ask since Im a little overwhelmed as to how I can effectively review your PR, it seems some internal knowledge is required.

@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 22, 2025 20:13 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 22, 2025 20:13 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 22, 2025 20:13 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 22, 2025 20:13 — with GitHub Actions Waiting
@rithin-pullela-aws
Copy link
Contributor Author

Hey @rithin-pullela-aws. What are some reviewing objectives? I ask since Im a little overwhelmed as to how I can effectively review your PR, it seems some internal knowledge is required.

Hi Brian, sorry about the delayed response. I updated the PR description with more details

@rithin-pullela-aws rithin-pullela-aws had a problem deploying to ml-commons-cicd-env-require-approval May 30, 2025 23:07 — with GitHub Actions Error
@rithin-pullela-aws rithin-pullela-aws deployed to ml-commons-cicd-env-require-approval May 30, 2025 23:07 — with GitHub Actions Active
@rithin-pullela-aws rithin-pullela-aws had a problem deploying to ml-commons-cicd-env-require-approval May 30, 2025 23:07 — with GitHub Actions Failure
@rithin-pullela-aws rithin-pullela-aws temporarily deployed to ml-commons-cicd-env-require-approval May 30, 2025 23:07 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn merged commit 1eff71b into opensearch-project:main May 30, 2025
7 of 9 checks passed
@rithin-pullela-aws rithin-pullela-aws requested a deployment to ml-commons-cicd-env-require-approval May 31, 2025 01:00 — with GitHub Actions Waiting
@rithin-pullela-aws rithin-pullela-aws requested a deployment to ml-commons-cicd-env-require-approval May 31, 2025 01:00 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Code Quality] Add test cases for MCP experimental feature
4 participants